package com.nimitz.modules.approval.service.impl;


import com.nimitz.modules.approval.domain.ApprovalUser;
import com.nimitz.modules.approval.mapper.ApprovalUserMapper;
import com.nimitz.modules.approval.service.IApprovalUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @ClassName ApprovalUserServiceImpl
 * @Author FuCun
 * @Date 2021-08-17-14:45
 * @PackageName com.nimitz.modules.approval.service.impl
 * @Description 审批人员-实现
 * @Version 1.0.0
 */
@Service
public class ApprovalUserServiceImpl implements IApprovalUserService {
    @Autowired
    private ApprovalUserMapper approvalUserMapper;

    /**
     * 查询所有审批人员信息（含搜索）
     *
     * @param approvalUser 审批人员
     * @return 审批人员集合
     */
    @Override
    public List<ApprovalUser> selectApprovalUserList(ApprovalUser approvalUser) {
        return approvalUserMapper.selectApprovalUserList(approvalUser);
    }

    /**
     * 新增审批人员
     *
     * @param approvalUser 审批人员
     * @return 结果
     */
    @Override
    public int insertApprovalUser(ApprovalUser approvalUser) {
        return approvalUserMapper.insertApprovalUser(approvalUser);
    }

    /**
     * 修改审批人员信息
     *
     * @param approvalUser 审批人员
     * @return 结果
     */
    @Override
    public int updateApprovalUser(ApprovalUser approvalUser) {
        return approvalUserMapper.updateApprovalUser(approvalUser);
    }

    /**
     * 删除审批人员
     *
     * @param userId 审批人员id
     * @return 结果
     */
    @Override
    public int deleteApprovalUserByUserId(Long userId) {
        return approvalUserMapper.deleteApprovalUserByUserId(userId);
    }

    /**
     * 校验审批人员姓名是否唯一
     *
     * @param userName 部门名称
     * @return 结果
     */
    @Override
    public ApprovalUser checkApprovalUserNameUnique(String userName) {
        return approvalUserMapper.checkApprovalUserNameUnique(userName);
    }
}
